//
//  LGDeviceInventoryTitleCell.m
//  HeartDiseaseManage
//
//  Created by 1234 on 2025/3/5.
//

#import "LGDeviceInventoryTitleCell.h"

@interface LGDeviceInventoryTitleCell()
/**   */
@property (nonatomic , strong)UILabel *titleLabel;
/**   */
@property (nonatomic , strong)UILabel *contentLabel;

@end

@implementation LGDeviceInventoryTitleCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.type = LGPositionTypeTop;
        [self.contentView addSubview:self.titleLabel];
        [self.contentView addSubview:self.contentLabel];
        [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.contentView).offset(viewPix(20));
            make.left.equalTo(self.contentView).offset(viewPix(28));
            make.width.equalTo(@(72));
        }];
        [self.contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.titleLabel);
            make.left.equalTo(self.titleLabel.mas_right).offset(viewPix(12));
            make.right.equalTo(self.contentView).offset(-viewPix(28));
            make.bottom.equalTo(self.contentView).offset(-viewPix(6));
        }];
    }
    return  self;
}

-(void)setDataDic:(NSDictionary *)dataDic{
    [super setDataDic:dataDic];
    NSString *title = LGNSString(dataDic[@"title"]);
    NSString *address = LGNSString(dataDic[@"address"]);
    if (address.length>0) {
        self.contentLabel.text = [NSString stringWithFormat:@"%@(%@)",title,address];
    }else{
        self.contentLabel.text = title;
    }
    [self.contentLabel lineSpacing:5];
}


-(UILabel *)titleLabel{
    if(!_titleLabel){
        _titleLabel = [UILabel lableWithText:@"当前仓库" colorString:@"#606266" textFont:LGFont(16) textAlignment:NSTextAlignmentLeft lines:1];
    }
    return _titleLabel;
}

-(UILabel *)contentLabel{
    if(!_contentLabel){
        _contentLabel = [UILabel lableWithText:@"" colorString:@"#282828" textFont:LGFont(16) textAlignment:NSTextAlignmentLeft lines:0];
    }
    return _contentLabel;
}

@end
